package _220308;

import java.util.Scanner;
import java.util.TreeMap;

/**
 * @author ShadowLim
 * @create 2022-03-08-17:25
 */
public class _单词分析 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        scanner.close();
        char[] sc = s.toCharArray();
        TreeMap<Character, Integer> map = new TreeMap<>();
        for (int i = 0; i < sc.length; i++) {
            if (map.containsKey(sc[i])) {
                map.put(sc[i], map.get(sc[i]) + 1);
            } else {
                map.put(sc[i], 1);
            }
        }
        char idx = '0';
        int maxCnt = 0;
        for (char ch : map.keySet()) {
            if (map.get(ch) > maxCnt) {
                maxCnt = map.get(ch);
                idx = ch;
            }
        }
        System.out.println(idx + "\n" + maxCnt);
    }
}
